import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../routes/app_routes.dart';

/// 未授权页面视图
class UnauthorizedView extends StatelessWidget {
  const UnauthorizedView({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('访问受限'),
      ),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(24.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              // 锁图标
              const Icon(
                Icons.lock_outline,
                size: 80,
                color: Colors.orange,
              ),
              
              const SizedBox(height: 24),
              
              // 标题
              const Text(
                '访问受限',
                style: TextStyle(
                  fontSize: 24,
                  fontWeight: FontWeight.bold,
                ),
              ),
              
              const SizedBox(height: 16),
              
              // 说明
              const Text(
                '您没有权限访问此页面，请先登录或联系管理员获取访问权限。',
                textAlign: TextAlign.center,
                style: TextStyle(
                  fontSize: 16,
                  color: Colors.grey,
                ),
              ),
              
              const SizedBox(height: 32),
              
              // 登录按钮
              ElevatedButton(
                onPressed: () => Get.offAllNamed(AppRoutes.LOGIN),
                style: ElevatedButton.styleFrom(
                  padding: const EdgeInsets.symmetric(
                    horizontal: 32,
                    vertical: 12,
                  ),
                ),
                child: const Text('前往登录'),
              ),
              
              const SizedBox(height: 16),
              
              // 返回首页按钮
              TextButton(
                onPressed: () => Get.offAllNamed(AppRoutes.SPLASH),
                child: const Text('返回首页'),
              ),
            ],
          ),
        ),
      ),
    );
  }
} 